import { defineStore } from "pinia";
import { userdata } from "@/api/userdata.js";
// 创建数据统计管理仓库
export const usedataStore = defineStore("dataStore", {
  state: () => {
    return {
      userList: [], //用户列表
    };
  },
  actions: {
    // 转换时间格式 为 2022-12-07 00:00:00 格式
    timeTrans(time, type) {
      let date = new Date(new Date(time).getTime() + 8 * 3600 * 1000);
      date = date.toJSON();
      if (type === 1) {
        date = date.substring(0, 10);
      } else {
        date = date.substring(0, 19).replace("T", " ");
      }
      return date;
    },
  },
});
